{% extends "base.html" %}

{% block title %}项目列表 - 开源安全创意工坊{% endblock %}

{% block content %}
<div class="d-flex justify-content-between align-items-center mb-4">
    <h2><i class="fas fa-project-diagram"></i> 所有项目</h2>
    <a href="{{ url_for('create_project') }}" class="btn btn-primary">
        <i class="fas fa-plus"></i> 创建新项目
    </a>
</div>

{% if projects %}
    <div class="row">
        {% for project in projects %}
            <div class="col-md-6 col-lg-4 mb-4">
                <div class="card h-100">
                    <div class="card-header bg-light">
                        <div class="d-flex justify-content-between align-items-center">
                            <h5 class="card-title mb-0">{{ project.name }}</h5>
                            {% if project.is_featured %}
                                <span class="badge bg-warning">
                                    <i class="fas fa-star"></i> 优秀
                                </span>
                            {% endif %}
                        </div>
                    </div>
                    <div class="card-body">
                        <p class="card-text">{{ project.description }}</p>
                        
                        <div class="mb-3">
                            <strong>团队成员：</strong>
                            {% if project.team_members %}
                                {% set members = project.team_members|fromjson %}
                                {% for member in members %}
                                    <span class="badge bg-secondary me-1">{{ member }}</span>
                                {% endfor %}
                            {% else %}
                                <span class="text-muted">暂无成员信息</span>
                            {% endif %}
                        </div>
                        
                        {% if project.github_url %}
                            <p class="small">
                                <i class="fab fa-github"></i> 
                                <a href="{{ project.github_url }}" target="_blank" class="text-decoration-none">
                                    查看代码仓库
                                </a>
                            </p>
                        {% endif %}
                        
                        <p class="small text-muted">
                            <i class="fas fa-calendar"></i> 创建于 {{ project.created_at.strftime('%Y-%m-%d') }}
                        </p>
                    </div>
                    <div class="card-footer">
                        <div class="d-flex justify-content-between">
                            <a href="{{ url_for('project_detail', project_id=project.id) }}" class="btn btn-outline-primary btn-sm">
                                <i class="fas fa-eye"></i> 查看详情
                            </a>
                            <a href="{{ url_for('roadshow', project_id=project.id) }}" class="btn btn-outline-success btn-sm">
                                <i class="fas fa-file-pdf"></i> 路演工具
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        {% endfor %}
    </div>
{% else %}
    <div class="text-center py-5">
        <i class="fas fa-inbox fa-5x text-muted mb-4"></i>
        <h4 class="text-muted">还没有项目</h4>
        <p class="text-muted">成为第一个创建项目的人吧！</p>
        <a href="{{ url_for('create_project') }}" class="btn btn-primary btn-lg">
            <i class="fas fa-plus"></i> 创建第一个项目
        </a>
    </div>
{% endif %}
{% endblock %}
